package cn.iocoder.yudao.module.digital.framework.cardkey.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

@Component
@ConfigurationProperties(prefix = "digital.cardkey")
@Data
public class CardKeyConfig {
    private String proxyHost; // 代理host
    private Integer proxyPort; // 代理端口
    private String certPath;
    private String macCertPath;
    private String certPassword;
    private String mid; // The contract id of the client (aka Merchant ID, MID)
    private String tenantId = null;
    private String host;
    private String generateCardUri;
    private String reverseCardUri;
    private String voidCardUri;
    private String getAccountUri;
    private String getProductCatalogsUri;
    private String getProductCatalogUri;
    private String getProductUri;
    private Boolean mockOrder = false; // 是否Mock订单数据
    private Boolean enableSynCardKeyProduct = false; // 是否打开同步卡密商品
    private List<Country> countries; // 支持的国家
    private Boolean verifyPaymentPrice = true; // 校验订单金额不能小于商品面值

    private Bamboo bamboo; // Bamboo配置
    private Global global; // 全局配置
    private Map<String, ChannelDifferenceData> channelDifference;

    @Data
    public static class Country {
        private String countryCode;
        private List<String> stateCodes;
    }

    @Data
    public static class Bamboo {
        private String host;
        private String userName;
        private String password;
        private Integer accountId;
    }

    @Data
    public static class Global {
        private Long inQueueTimeoutMinutes;
    }

    @Data
    public static class ChannelDifferenceData {
        private Integer outQueueTimeoutMinutes;
        private Boolean parallelOrder;
        private Boolean multipleQuantitiesOrder;
        private Boolean aggregatedOrder;
    }

}
